package com.matt.repository;

import com.matt.domain.TargetObject;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/3/9
 * *******************************
 */
public interface TargetObjectRepository extends JpaRepository<TargetObject, String>{

    List<TargetObject> findByDeletedOrderByCodeAsc(Boolean deleted);

    TargetObject findByName(String name);

    @Query(value = "SELECT *  FROM  target_object where  code > 0  and deleted = 0", nativeQuery = true)
    List<TargetObject> findAllCode();
}
